﻿<phone:PhoneApplicationPage
    x:Class="ChinaUnicom.Views.FeeHistoriesListPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:src="clr-namespace:ChinaUnicom.Converters"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"    
    mc:Ignorable="d"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False"
    toolkit:TiltEffect.IsTiltEnabled="True" 
    d:DesignHeight="800" d:DesignWidth="480"
    Name="this">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <phone:PhoneApplicationPage.Resources>
        <Style x:Key="ProgressBarStyle" TargetType="ProgressBar">
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" >
            <Rectangle Style="{StaticResource PageTopRectangleStyle}"/>
            <Border Style="{StaticResource PageTopBorderStyle}">
                <TextBlock Text="联通助手" Style="{StaticResource PageTopTextStyle}"/>
            </Border>
        </StackPanel>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="1" Margin="12,10,12, 0">
            <TextBlock Text="历史账单" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="2" Margin="12, 12, 12, 0">
            <ScrollViewer>
                <ItemsControl Margin="12 0" ItemsSource="{Binding FeeHistories}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button Margin="0 10" 
                                                Grid.Column="1" 
                                                Template="{StaticResource SampleButtonTemplate}"
                                                Command="{Binding ElementName=this, Path=DataContext.MoreFeeHistoriesCommand}"
                                                CommandParameter="{Binding Occurred}">
                                <Button.Content>
                                    <StackPanel>
                                        <TextBlock Text="{Binding Occurred, Converter={StaticResource dateConverter},ConverterParameter=YYYYMM}" 
                                                       FontSize="30"/>

                                        <TextBlock Foreground="{StaticResource PhoneAccentBrush}" FontSize="20">
                                                    <Run Text="消费合计 : "/>
                                                    <Run Text="{Binding Fee}"/>
                                        </TextBlock>
                                    </StackPanel>
                                </Button.Content>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
        </Grid>

        <ProgressBar IsEnabled="{Binding ProgressEnabled}" 
                     IsIndeterminate="{Binding ProgressEnabled}" 
                     Visibility="{Binding ProgressEnabled, Converter={StaticResource booleanVisibilityConverter}}" 
                     Style="{StaticResource ProgressBarStyle}"/>

    </Grid>


    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Themes/Images/back.png" Text="返回" Click="OnBackClick" />
            <shell:ApplicationBarIconButton IconUri="/Themes/Images/download.png" Text="强制更新" Click="OnDownloadClick" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>